<?php
namespace App\Http\Controllers\School;

use App\Http\Resources\School\SchoolAdminLogResource;
use App\Models\SchoolAdminLog;
use Illuminate\Http\Request;

/**
 * Class SchoolAdminLogController
 * @package App\Http\Controllers\School
 * 学校后台操作日志
 */
class SchoolAdminLogController extends BaseController
{
    /**
     * @param Request $request
     * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
     */
    public function index(Request $request)
    {
        $schoolAdminLog = SchoolAdminLog::orderBy('action_time', 'desc')
            ->with('schoolAdmin')
            ->schoolIdIs(\Auth::user()->school_id)
            ->nameLike($request->name)
            ->paginate($request->size);
        return SchoolAdminLogResource::collection($schoolAdminLog);
    }
}

